package com.service.data.commons.utils

class Preconditions {

}

object Preconditions {
  def checkNotNull[T](reference: T, errorMessage: Any = null): T = {
    if (reference == null) {
      throw new NullPointerException(String.valueOf(errorMessage))
    } else {
      reference
    }
  }

  def getOrElse[T](reference: T, default: T): T = {
    if (reference == null) {
      default
    } else {
      reference
    }
  }
}
